home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / include / sys / file.h < prev    next >
C/C++ Source or Header  |  1991-04-09  |  3KB  |  100 lines

  1. /*
  2.  * Copyright (c) 1982, 1986 Regents of the University of California.
  3.  * All rights reserved.  The Berkeley software License Agreement
  4.  * specifies the terms and conditions for redistribution.
  5.  *
  6.  *    @(#)file.h    7.1 (Berkeley) 6/4/86
  7.  */
  8.  
  9. #ifndef _FILE
  10. #define _FILE
  11.  
  12. /*
  13.  * flags- also for fcntl call.
  14.  */
  15. #define    FOPEN        (-1)
  16. #define    FREAD        00001        /* descriptor read/receive'able */
  17. #define    FWRITE        00002        /* descriptor write/send'able */
  18. #ifndef    F_DUPFD
  19. #define    FNDELAY        00004        /* no delay */
  20. #define    FAPPEND        00010        /* append on each write */
  21. #endif
  22. #define    FMARK        00020        /* mark during gc() */
  23. #define    FDEFER        00040        /* defer for next gc pass */
  24. #ifndef    F_DUPFD
  25. #define    FASYNC        00100        /* signal pgrp when data ready */
  26. #endif
  27. #define    FSHLOCK        00200        /* shared lock present */
  28. #define    FEXLOCK        00400        /* exclusive lock present */
  29.  
  30. /* bits to save after open */
  31. #define    FMASK        00113
  32. #define    FCNTLCANT    (FREAD|FWRITE|FMARK|FDEFER|FSHLOCK|FEXLOCK)
  33.  
  34. /* open only modes */
  35. #define    FCREAT        01000        /* create if nonexistant */
  36. #define    FTRUNC        02000        /* truncate to zero length */
  37. #define    FEXCL        04000        /* error if already created */
  38.  
  39. #ifndef    F_DUPFD
  40. /* fcntl(2) requests--from <fcntl.h> */
  41. #define    F_DUPFD    0    /* Duplicate fildes */
  42. #define    F_GETFD    1    /* Get fildes flags */
  43. #define    F_SETFD    2    /* Set fildes flags */
  44. #define    F_GETFL    3    /* Get file flags */
  45. #define    F_SETFL    4    /* Set file flags */
  46. #define    F_GETOWN 5    /* Get owner */
  47. #define F_SETOWN 6    /* Set owner */
  48. #define    F_GETLK    7    /* Get record-lock info */
  49. #define    F_SETLK    8    /* Set or clear a record-lock */
  50. #define    F_SETLKW    9    /* Set or clear a record-lock (blocking) */
  51. #define    F_RGETLK    10    /* Test if lock blocked */
  52. #define    F_RSETLK    11    /* Set or unlock lock */
  53. #define    F_CNVT        12    /* Convert fhandle to fd */
  54. #define    F_RSETLKW    13    /* Set or clear remote lock (blocking) */
  55.  
  56. #endif
  57.  
  58. /*
  59.  * User definitions.
  60.  */
  61.  
  62. /*
  63.  * Open call.
  64.  */
  65. #define    O_RDONLY    000        /* open for reading */
  66. #define    O_WRONLY    001        /* open for writing */
  67. #define    O_RDWR        002        /* open for read & write */
  68. #define    O_NDELAY    FNDELAY        /* non-blocking open */
  69. #define    O_APPEND    FAPPEND        /* append on each write */
  70. #define    O_CREAT        FCREAT        /* open with file create */
  71. #define    O_TRUNC        FTRUNC        /* open with truncation */
  72. #define    O_EXCL        FEXCL        /* error on create if file exists */
  73. #define O_MASTER    010000        /* open pseudo-device as master */
  74. #define O_PFS_MASTER    020000        /* open as pseudo-filesystem master */
  75.  
  76. /*
  77.  * Flock call.
  78.  */
  79. #define    LOCK_SH        1    /* shared lock */
  80. #define    LOCK_EX        2    /* exclusive lock */
  81. #define    LOCK_NB        4    /* don't block when locking */
  82. #define    LOCK_UN        8    /* unlock */
  83.  
  84. /*
  85.  * Access call.
  86.  */
  87. #define    F_OK        0    /* does file exist */
  88. #define    X_OK        1    /* is it executable by caller */
  89. #define    W_OK        2    /* writable by caller */
  90. #define    R_OK        4    /* readable by caller */
  91.  
  92. /*
  93.  * Lseek call.
  94.  */
  95. #define    L_SET        0    /* absolute offset */
  96. #define    L_INCR        1    /* relative to current offset */
  97. #define    L_XTND        2    /* relative to end of file */
  98.  
  99. #endif /* _FILE */
  100.